package com.xigua.nio;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

public class NIOFileChannel04 {

    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("D:\\learning\\FileTest\\Koala.jpg");
        FileOutputStream fileOutputStream = new FileOutputStream("D:\\learning\\FileTest\\Koala2.jpg");

        FileChannel inChannel = fileInputStream.getChannel();
        FileChannel outChannel = fileOutputStream.getChannel();

        outChannel.transferFrom(inChannel,0,inChannel.size());

        outChannel.close();
        inChannel.close();
        fileInputStream.close();
        fileOutputStream.close();


    }
}
